package app.fugema.shop.main.goods.adapter;

import android.view.View;

import com.base.common.view.adapter.ada.BaseRVAdapter;
import com.base.common.view.adapter.connector.BaseItemMultiType;
import app.fugema.shop.R;
import app.fugema.shop.databinding.SeckillPrecinctItemBinding;
import app.fugema.shop.main.goods.view.GoodsDetailActivity;
import app.fugema.shop.main.order.model.GroupBookingBean;

public class SeckillPrecinctItemMultiType extends BaseItemMultiType<GroupBookingBean.RecordsBean, SeckillPrecinctItemBinding> {
    @Override
    public int getLayoutId() {
        return R.layout.seckill_precinct_item;
    }


    @Override
    public void onBindViewHolder(SeckillPrecinctItemBinding binding, int position, GroupBookingBean.RecordsBean bean) {
        super.onBindViewHolder(binding, position, bean);
        if (bean.getLimitCount() > 0) {
            int bb = bean.getSaleCount() * 100 / bean.getLimitCount();
            binding.pbProgress.setProgress(bb);
            binding.tvProgress.setText(bb + "%");
        } else {
            binding.pbProgress.setProgress(0);
            binding.tvProgress.setText("0%");
        }

    }

    @Override
    public void onItemClick(View view, BaseRVAdapter adapter, int onclickType, int position, GroupBookingBean.RecordsBean bean) {
        super.onItemClick(view, adapter, onclickType, position, bean);
        GoodsDetailActivity.start(view.getContext(), bean);
    }

}
